package cn.java.Concurrency.executor;

import java.util.concurrent.Callable;

/**
 * @author 小石潭记
 * @date 2021/12/19 19:51
 * @Description: ${todo}
 */
public class MyCallableB2 implements Callable<String> {
    @Override
    public String call() throws Exception {
        System.out.println("mycallableB begin " + System.currentTimeMillis());
        for (int i = 0; i < 123456; i++) {
            if (Thread.currentThread().isInterrupted() == false) {
                Math.random();
                Math.random();
                Math.random();
                System.out.println("mycallableB2" + (i + 1));
            } else {
                System.out.println("*********抛出异常中断了");
                throw new InterruptedException();
            }

        }
        System.out.println("mycallableB2 end " + System.currentTimeMillis());
        return "return A";
    }
}
